package org.dtrd.modules.service.entity.bean;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.service.entity.po.DtrdRlPackagePatient;

import java.util.Date;

/**
 * @author qr
 * @date 2022/1/6 10:01
 */
@ApiModel("患者服务列表对象")
@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PatientPackageListInfo {

    @ApiModelProperty(value = "服务包id")
    private Integer packageId;
    @ApiModelProperty("服务包名字")
    private String packageName;

    @ApiModelProperty("状态")
    private Integer status;
    @ApiModelProperty("状态文本")
    private String statusText;

    @ApiModelProperty("机构编码")
    private String orgCode;
    @ApiModelProperty("机构名字")
    private String orgName;

    @ApiModelProperty("计划名称")
    private String planName;

    @ApiModelProperty("缩略图")
    private String packageThumb;

    @ApiModelProperty("有效周期")
    private String validPeriod;

    public PatientPackageListInfo parseFromPO(DtrdRlPackagePatient po) {
        packageId = po.getDataId();
        status = po.getStatus();
        orgCode = po.getOrgCode();
        Date startTime = po.getStartTime();
        Date endTime = po.getEndTime();
        if (startTime != null && endTime != null) {
            validPeriod = DateUtils.combineTwoTime(startTime, endTime);
        }
        return this;
    }
}
